3.3.8 \(\int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx\) [208]

3.3.8.1 Optimal result
3.3.8.2 Mathematica [A] (verified)
3.3.8.3 Rubi [A] (verified)
3.3.8.4 Maple [F]
3.3.8.5 Fricas [F]
3.3.8.6 Sympy [F]
3.3.8.7 Maxima [F(-2)]
3.3.8.8 Giac [F]
3.3.8.9 Mupad [F(-1)]

3.3.8.1 Optimal result

Integrand size = 34, antiderivative size = 168 \[ \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {(A (1-m)-i B (1+m)) \operatorname {Hypergeometric2F1}\left (1,\frac {1+m}{2},\frac {3+m}{2},-\tan ^2(c+d x)\right ) \tan ^{1+m}(c+d x)}{2 a d (1+m)}+\frac {(i A-B) m \operatorname {Hypergeometric2F1}\left (1,\frac {2+m}{2},\frac {4+m}{2},-\tan ^2(c+d x)\right ) \tan ^{2+m}(c+d x)}{2 a d (2+m)}+\frac {(A+i B) \tan ^{1+m}(c+d x)}{2 d (a+i a \tan (c+d x))} \]

output
1/2*(A*(1-m)-I*B*(1+m))*hypergeom([1, 1/2+1/2*m],[3/2+1/2*m],-tan(d*x+c)^2 
)*tan(d*x+c)^(1+m)/a/d/(1+m)+1/2*(I*A-B)*m*hypergeom([1, 1+1/2*m],[2+1/2*m 
],-tan(d*x+c)^2)*tan(d*x+c)^(2+m)/a/d/(2+m)+1/2*(A+I*B)*tan(d*x+c)^(1+m)/d 
/(a+I*a*tan(d*x+c))
 
3.3.8.2 Mathematica [A] (verified)

Time = 1.89 (sec) , antiderivative size = 137, normalized size of antiderivative = 0.82 \[ \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {\tan ^{1+m}(c+d x) \left (-\frac {(A (-1+m)+i B (1+m)) \operatorname {Hypergeometric2F1}\left (1,\frac {1+m}{2},\frac {3+m}{2},-\tan ^2(c+d x)\right )}{1+m}+\frac {i (A+i B) m \operatorname {Hypergeometric2F1}\left (1,\frac {2+m}{2},\frac {4+m}{2},-\tan ^2(c+d x)\right ) \tan (c+d x)}{2+m}+\frac {-i A+B}{-i+\tan (c+d x)}\right )}{2 a d} \]

input
Integrate[(Tan[c + d*x]^m*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]
 
output
(Tan[c + d*x]^(1 + m)*(-(((A*(-1 + m) + I*B*(1 + m))*Hypergeometric2F1[1, 
(1 + m)/2, (3 + m)/2, -Tan[c + d*x]^2])/(1 + m)) + (I*(A + I*B)*m*Hypergeo 
metric2F1[1, (2 + m)/2, (4 + m)/2, -Tan[c + d*x]^2]*Tan[c + d*x])/(2 + m) 
+ ((-I)*A + B)/(-I + Tan[c + d*x])))/(2*a*d)
 
3.3.8.3 Rubi [A] (verified)

Time = 0.57 (sec) , antiderivative size = 164, normalized size of antiderivative = 0.98, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.206, Rules used = {3042, 4079, 3042, 4021, 3042, 3957, 278}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (c+d x)^m (A+B \tan (c+d x))}{a+i a \tan (c+d x)}dx\)

\(\Big \downarrow \) 4079

\(\displaystyle \frac {\int \tan ^m(c+d x) (a (-m A+A-i B (m+1))+a (i A-B) m \tan (c+d x))dx}{2 a^2}+\frac {(A+i B) \tan ^{m+1}(c+d x)}{2 d (a+i a \tan (c+d x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \tan (c+d x)^m (a (-m A+A-i B (m+1))+a (i A-B) m \tan (c+d x))dx}{2 a^2}+\frac {(A+i B) \tan ^{m+1}(c+d x)}{2 d (a+i a \tan (c+d x))}\)

\(\Big \downarrow \) 4021

\(\displaystyle \frac {a m (-B+i A) \int \tan ^{m+1}(c+d x)dx+a (A (-m)+A-i B (m+1)) \int \tan ^m(c+d x)dx}{2 a^2}+\frac {(A+i B) \tan ^{m+1}(c+d x)}{2 d (a+i a \tan (c+d x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a (A (-m)+A-i B (m+1)) \int \tan (c+d x)^mdx+a m (-B+i A) \int \tan (c+d x)^{m+1}dx}{2 a^2}+\frac {(A+i B) \tan ^{m+1}(c+d x)}{2 d (a+i a \tan (c+d x))}\)

\(\Big \downarrow \) 3957

\(\displaystyle \frac {\frac {a m (-B+i A) \int \frac {\tan ^{m+1}(c+d x)}{\tan ^2(c+d x)+1}d\tan (c+d x)}{d}+\frac {a (A (-m)+A-i B (m+1)) \int \frac {\tan ^m(c+d x)}{\tan ^2(c+d x)+1}d\tan (c+d x)}{d}}{2 a^2}+\frac {(A+i B) \tan ^{m+1}(c+d x)}{2 d (a+i a \tan (c+d x))}\)

\(\Big \downarrow \) 278

\(\displaystyle \frac {\frac {a (A (-m)+A-i B (m+1)) \tan ^{m+1}(c+d x) \operatorname {Hypergeometric2F1}\left (1,\frac {m+1}{2},\frac {m+3}{2},-\tan ^2(c+d x)\right )}{d (m+1)}+\frac {a m (-B+i A) \tan ^{m+2}(c+d x) \operatorname {Hypergeometric2F1}\left (1,\frac {m+2}{2},\frac {m+4}{2},-\tan ^2(c+d x)\right )}{d (m+2)}}{2 a^2}+\frac {(A+i B) \tan ^{m+1}(c+d x)}{2 d (a+i a \tan (c+d x))}\)

input
Int[(Tan[c + d*x]^m*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]
 
output
((A + I*B)*Tan[c + d*x]^(1 + m))/(2*d*(a + I*a*Tan[c + d*x])) + ((a*(A - A 
*m - I*B*(1 + m))*Hypergeometric2F1[1, (1 + m)/2, (3 + m)/2, -Tan[c + d*x] 
^2]*Tan[c + d*x]^(1 + m))/(d*(1 + m)) + (a*(I*A - B)*m*Hypergeometric2F1[1 
, (2 + m)/2, (4 + m)/2, -Tan[c + d*x]^2]*Tan[c + d*x]^(2 + m))/(d*(2 + m)) 
)/(2*a^2)
 

3.3.8.3.1 Defintions of rubi rules used

rule 278
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[a^p*(( 
c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/2, (m + 1)/2 + 1, ( 
-b)*(x^2/a)], x] /; FreeQ[{a, b, c, m, p}, x] &&  !IGtQ[p, 0] && (ILtQ[p, 0 
] || GtQ[a, 0])
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3957
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d   Subst[Int 
[x^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{b, c, d, n}, x] && 
!IntegerQ[n]
 

rule 4021
Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Tan[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ[c^ 
2 + d^2, 0] &&  !IntegerQ[2*m]
 

rule 4079
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + 
(f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim 
p[(a*A + b*B)*(a + b*Tan[e + f*x])^m*((c + d*Tan[e + f*x])^(n + 1)/(2*f*m*( 
b*c - a*d))), x] + Simp[1/(2*a*m*(b*c - a*d))   Int[(a + b*Tan[e + f*x])^(m 
 + 1)*(c + d*Tan[e + f*x])^n*Simp[A*(b*c*m - a*d*(2*m + n + 1)) + B*(a*c*m 
- b*d*(n + 1)) + d*(A*b - a*B)*(m + n + 1)*Tan[e + f*x], x], x], x] /; Free 
Q[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] 
 && LtQ[m, 0] &&  !GtQ[n, 0]
 
3.3.8.4 Maple [F]

\[\int \frac {\left (\tan ^{m}\left (d x +c \right )\right ) \left (A +B \tan \left (d x +c \right )\right )}{a +i a \tan \left (d x +c \right )}d x\]

input
int(tan(d*x+c)^m*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)
 
output
int(tan(d*x+c)^m*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)
 
3.3.8.5 Fricas [F]

\[ \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\int { \frac {{\left (B \tan \left (d x + c\right ) + A\right )} \tan \left (d x + c\right )^{m}}{i \, a \tan \left (d x + c\right ) + a} \,d x } \]

input
integrate(tan(d*x+c)^m*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="f 
ricas")
 
output
integral(1/2*((A - I*B)*e^(2*I*d*x + 2*I*c) + A + I*B)*((-I*e^(2*I*d*x + 2 
*I*c) + I)/(e^(2*I*d*x + 2*I*c) + 1))^m*e^(-2*I*d*x - 2*I*c)/a, x)
 
3.3.8.6 Sympy [F]

\[ \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=- \frac {i \left (\int \frac {A \tan ^{m}{\left (c + d x \right )}}{\tan {\left (c + d x \right )} - i}\, dx + \int \frac {B \tan {\left (c + d x \right )} \tan ^{m}{\left (c + d x \right )}}{\tan {\left (c + d x \right )} - i}\, dx\right )}{a} \]

input
integrate(tan(d*x+c)**m*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)
 
output
-I*(Integral(A*tan(c + d*x)**m/(tan(c + d*x) - I), x) + Integral(B*tan(c + 
 d*x)*tan(c + d*x)**m/(tan(c + d*x) - I), x))/a
 
3.3.8.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\text {Exception raised: RuntimeError} \]

input
integrate(tan(d*x+c)^m*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="m 
axima")
 
output
Exception raised: RuntimeError >> ECL says: THROW: The catch RAT-ERR is un 
defined.
 
3.3.8.8 Giac [F]

\[ \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\int { \frac {{\left (B \tan \left (d x + c\right ) + A\right )} \tan \left (d x + c\right )^{m}}{i \, a \tan \left (d x + c\right ) + a} \,d x } \]

input
integrate(tan(d*x+c)^m*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="g 
iac")
 
output
integrate((B*tan(d*x + c) + A)*tan(d*x + c)^m/(I*a*tan(d*x + c) + a), x)
 
3.3.8.9 Mupad [F(-1)]

Timed out. \[ \int \frac {\tan ^m(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\int \frac {{\mathrm {tan}\left (c+d\,x\right )}^m\,\left (A+B\,\mathrm {tan}\left (c+d\,x\right )\right )}{a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}} \,d x \]

input
int((tan(c + d*x)^m*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i),x)
 
output
int((tan(c + d*x)^m*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i), x)